package com.cplatform.movie.back.order.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import net.sf.json.JSONObject;

/**
 * 订单和商品对应表
 * <p>
 * @author 左天宇
 * <p>
 * @package com.z.item.entity
 * <p>
 * @time 下午4:15:47 2015年6月6日
 */
@Entity
@Table(name="t_order_item_link")
public class OrderItemLink implements Serializable{

	private static final long serialVersionUID = 1L;

	@SequenceGenerator(name = "seq_item", sequenceName = "SEQ_SMALL_SHOP_SEQ")
	@Id
	@GeneratedValue(generator = "seq_item")
	private Long id;

	/**
	 * 商品总价
	 */
	@Column(precision=10,scale=2,name="total_price")
	private double totalPrice;
	
	/**
	 * 商品数量
	 */
	@Column(precision=10,name="num")
	private Long num;
	
	/**
	 * 商品名称
	 */
	@Column(length=50,name="item_name")
	private String itemName;

	/**
	 * 订单编号
	 */
	@Column(precision=9,name="order_id")
	private Long orderId;
	
	/**
	 * 商品编号
	 */
	@Column(precision=9,name="item_id")
	private Long itemId;
	
	/**
	 * 商户名
	 */
	@Column(name="SHOP_NAME")
	private String shopName;
	
	/**
	 * 商户id
	 */
	@Column(name="SHOP_ID")
	private Long shopId;
	
	/**
	 * 创建时间
	 */
	@Column(name="CREATE_TIME")
	private String createTime;
	
	/**
	 * 商品单价
	 */
	@Column(name="PER_PRICE")
	private double perPrice;
	
	public double getPerPrice() {
		return perPrice;
	}
	
	public void setPerPrice(double perPrice) {
		this.perPrice = perPrice;
	}
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public double getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(double totalPrice) {
		this.totalPrice = totalPrice;
	}

	public Long getNum() {
		return num;
	}

	public void setNum(Long num) {
		this.num = num;
	}

	public String getItemName() {
		return itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}
	
	public Long getOrderId() {
		return orderId;
	}

	public void setOrderId(Long orderId) {
		this.orderId = orderId;
	}
	
	public Long getItemId() {
		return itemId;
	}

	public void setItemId(Long itemId) {
		this.itemId = itemId;
	}

	public Long getShopId() {
		return shopId;
	}
	
	public void setShopId(Long shopId) {
		this.shopId = shopId;
	}
	
	public String getShopName() {
		return shopName;
	}
	
	public void setShopName(String shopName) {
		this.shopName = shopName;
	}
	
	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	@Transient
	private String createEndTime; // 创建结束时间
	
	public String getCreateEndTime() {
		return createEndTime;
	}

	public void setCreateEndTime(String createEndTime) {
		this.createEndTime = createEndTime;
	}

	@Override
	public String toString() {
		return JSONObject.fromObject(this).toString();
	}
}
